let url = '/account/findAccountById';
$(function () {
    var accountId = window.localStorage.getItem("accountId")

    var params = {
        accountId: accountId
    }
    $.get(url, params, getDate)
})

function getDate(resp) {
    if (resp.status === 200) {
        var account = resp.data

        var recommenderId = account.recommenderId;

        $('#accountId').val(account.accountId)
        $('#realName').val(account.realName)
        $('#idcardNo').val(account.idcardNo)
        $('#loginName').val(account.loginName)
        $('#telephone').val(account.telephone)
        $('#referrerId').val(recommenderId)
        // 状态
        // 开通
        $('#last_login_time').val(account.lastLoginTime)
        $('#last_login_ip').val(account.lastLoginIp)
        $('#birthdate').val(account.birthdate)
        $('#email').val(account.email)
        // 职业
        // 性别
        $('#mailAddress').val(account.mailaddress)
        $('#zipCode').val(account.zipcode)
        $('#qq').val(account.qq)


        switch (account.accountStatus) {
            case 1:
                $('#start').attr('selected', 'selected')
                $('#time').val(account.createDate)
                break;
            case 2:
                $('#pause').attr('selected', 'selected')
                $('#time').val(account.pauseDate)
                break;
            default:
                $('#delete').attr('selected', 'selected')
                $('#time').val(account.closeDate)
                break;
        }

        switch (account.occupation) {
            case '干部':
                $('#c').attr('selected', 'selected')
                break;
            case '学生':
                $('#s').attr('selected', 'selected')
                break;
            case '技术人员':
                $('#t').attr('selected', 'selected')
                break;
            default:
                $('#o').attr('selected', 'selected')
                break;
        }

        if (account.gender == '男') {
            $('#male').attr('checked', 'checked')
        } else {
            $('#female').attr('checked', 'checked')
        }


        var param = {
            accountId: recommenderId
        }
        $.get(url, param, function (resp) {
            $('#referrerCard').val(resp.data.idcardNo)
        })
    }
}
